﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MessagePanel.aspx.cs" Inherits="ZX.WebApp.MessagePanel" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
        <!-- Dependencies -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/yahoo-dom-event/yahoo-dom-event.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/element/element-min.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/datasource/datasource-min.js"></script>
    <!-- OPTIONAL: JSON Utility (for DataSource) -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/json/json-min.js"></script>
    <!-- OPTIONAL: Connection Manager (enables XHR for DataSource) -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/connection/connection-min.js"></script>
    <!-- OPTIONAL: Get Utility (enables dynamic script nodes for DataSource) -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/get/get-min.js"></script>
    <!-- OPTIONAL: Drag Drop (enables resizeable or reorderable columns) -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/dragdrop/dragdrop-min.js"></script>
    <!-- OPTIONAL: Calendar (enables calendar editors) -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/calendar/calendar-min.js"></script>
    <!-- Source files -->
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/datatable/datatable-min.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/layout/layout-min.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/button/button-min.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/container/container-min.js"></script>
    <script type="text/javascript" src="Scripts/yui_2.9.0/build/resize/resize-min.js"></script>
    <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
     <asp:Repeater ID="rptUnBegin" runat="server">
                                    <HeaderTemplate>
                                        <table class="tableContent" style="width: 100%; height: 100%">
                              <%--              <tr>
                                                <th>
                                                    消息
                                                </th>
                                            </tr>--%>
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <tr>
                                            <td><span>•</span>
                                                <a href="#" name='<%#Eval("MsgContent") %>' class='<%#Eval("MPoolID") %>' id="Message">
                                                   <%# String.Format("<font color='blue'><b>{0}</b></font>  [发送人:{1}]", Eval("Title"), Eval("AddUserName"))%>
                                                </a>
                                            </td>
                                            <td>
                                            <%# String.Format("{0}", String.Format("{0:U}", Eval("SendTime")))%>
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <FooterTemplate>
                                        </table>
                                    </FooterTemplate>
                                </asp:Repeater>
    </div>
            <div id="dialog5" class="yui-pe-content">
        <div class="hd">
            数据详情</div>
        <div class="bd">
            <iframe id="EditUIWindow1" frameborder="0" src="" style="width: 100%; height: 100%;
                margin: 0px; padding: 0px;"></iframe>
        </div>
    </div>
    </form>
</body>
<script type="text/javascript">
    var Tag = true;
    var mpoolIDValue; //信息池ID

    ///------------------------------------
    //系统的改修Message状态方法
    ///------------------------------------
    function fnMessageSendState(mpoolID) {
        ///初始化相关参数
        var url = "MessagePoolManage.aspx",
            action = "setSendState";
        if (mpoolID == "") { return; }
        var SaveUrl = url + "?r=" + Math.random() + "&poolid=" + mpoolID + "&action=" + action;

        //发送保存请求
        YAHOO.util.Connect.asyncRequest('POST', SaveUrl, {
            success: function (res) {
                try {
                    var str = res.responseText;
                    //                        if (str == "1")
                    //                        {
                    //                            alert("数据保存成功");
                    //                        }
                    //                        else
                    //                        {
                    //                            showCss("red");
                    //                            alert(str+"\n"+"数据保存失败!");
                    //                        }
                }
                catch (e) {
                }
                finally {
                }
            },
            failure: function (error) {
                alert("数据错误：" + error.statusText);
            }
        }, null);
    }

    function LoadData() {
        if (parent != null) {
            if (parent.Tag != null) {
                //fnMessageSendState(mpoolIDValue)

                parent.LoadData()
            }
        }


    }

    (function () {
        var Dom = YAHOO.util.Dom,
        Event = YAHOO.util.Event;
        Event.onDOMReady(function () {
            var layout = new YAHOO.widget.Layout({
                minHeight: 150,
                units: [
                { position: 'center', body: 'bd', gutter: '2 2 2 2', scroll: true }
            ]
            });
            layout.render();
        });
    })();




    //添加超链接点击事件
    $(document).ready(function () {
       
        $("a[id^=Message]").click(function () {
            var nameValue = $(this).attr("name");
            mpoolIDValue = $(this).attr("class");
            document.getElementById("EditUIWindow1").src = nameValue;
            // fnMessageSendState(mpoolIDValue);
            YAHOO.example.container.dialog5.show();
        });
    })

    YAHOO.namespace("example.container");
    YAHOO.util.Event.onDOMReady(function () {

        // Define various event handlers for Dialog

        var handleMessage = function () {
            var editwindow = document.getElementById("EditUIWindow1");
            if (editwindow) {
                editwindow.contentWindow.Save();
                YAHOO.example.container.dialog5.hide();
            }
        }


        var handleCancel = function () {
            this.cancel();
        };
        var handleSuccess = function (o) {
            var response = o.responseText;
            response = response.split("<!")[0];
            document.getElementById("resp").innerHTML = response;
        };
        var handleFailure = function (o) {
            alert("Submission failed: " + o.status);
        };

        // Remove progressively enhanced content class, just before creating the module
        YAHOO.util.Dom.removeClass("dialog1", "yui-pe-content");

        // Instantiate the Dialog

        YAHOO.example.container.dialog5 = new YAHOO.widget.Dialog("dialog5",
							    { width: "600px",
							        height: "600px",
							        fixedcenter: true,
							        visible: false,
							        draggable: true,
							        close: true,
							        autofillheight: "body",
							        constraintoviewport: true,
							        buttons: [{ text: "确定", handler: handleMessage, isDefault: true },

								          { text: "取消", handler: handleCancel}]

							    });
        YAHOO.example.container.dialog5.render();
        // Validate the entries in the form to require that both first and last name are entered
        YAHOO.example.container.dialog1.validate = function () {
            var data = this.getData();
            if (data.firstname == "" || data.lastname == "") {
                alert("Please enter your first and last names.");
                return false;
            } else {
                return true;
            }
        };

    });
</script>
</html>
